import requests

# 目标网址
url = 'https://www.bbc.com/'

# 发送GET请求
response = requests.get(url)

# 检查请求是否成功
if response.status_code == 200:
    # 获取网页内容
    data = response.text

    # 指定文件名保存内容
    filename = 'example.html'
    with open(filename, 'w', encoding='utf-8') as file:
        file.write(data)
    print(f'网页数据已保存到 {filename}')
else:
    print('请求失败')